<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: /data/users/matthijs/github_faiss/faiss/ProductQuantizer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">/data/users/matthijs/github_faiss/faiss/ProductQuantizer.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright (c) 2015-present, Facebook, Inc.</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * All rights reserved.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * This source code is licensed under the BSD+Patents license found in the</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * LICENSE file in the root directory of this source tree.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">// Copyright 2004-present Facebook. All Rights Reserved.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">// -*- c++ -*-</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#ifndef FAISS_PRODUCT_QUANTIZER_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define FAISS_PRODUCT_QUANTIZER_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &quot;Clustering.h&quot;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#include &quot;Heap.h&quot;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">namespace </span>faiss {</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">/** Product Quantizer. Implemented only for METRIC_L2 */</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html">   25</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structfaiss_1_1ProductQuantizer.html">ProductQuantizer</a> {</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">   27</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">d</a>;              <span class="comment">///&lt; size of the input vectors</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">   28</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">M</a>;              <span class="comment">///&lt; number of subquantizers</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">   29</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">nbits</a>;          <span class="comment">///&lt; number of bits per quantization index</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    <span class="comment">// values derived from the above</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">   32</a></span>&#160;    <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">dsub</a>;           <span class="comment">///&lt; dimensionality of each subvector</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a13bf69a0dc7b4e45792d10f458e4a92d">   33</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a13bf69a0dc7b4e45792d10f458e4a92d">byte_per_idx</a>;   <span class="comment">///&lt; nb bytes per code component (1 or 2)</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#aa61330eadb84772b71018b093773a5f9">   34</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#aa61330eadb84772b71018b093773a5f9">code_size</a>;      <span class="comment">///&lt; byte per indexed vector</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">   35</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">ksub</a>;           <span class="comment">///&lt; number of centroids for each subquantizer</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a1e4056fa3938ed8c9fe701e90d94ad95">   36</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">bool</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a1e4056fa3938ed8c9fe701e90d94ad95">verbose</a>;          <span class="comment">///&lt; verbose during training?</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">    /// initialization</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">   40</a></span>&#160;<span class="comment"></span>    <span class="keyword">enum</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">train_type_t</a> {</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        Train_default,</div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0">   42</a></span>&#160;        <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0">Train_hot_start</a>,   <span class="comment">///&lt; the centroids are already initialized</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d">   43</a></span>&#160;<span class="comment"></span>        <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d">Train_shared</a>,      <span class="comment">///&lt; share dictionary accross PQ segments</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e">   44</a></span>&#160;<span class="comment"></span>        <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e">Train_hypercube</a>,   <span class="comment">///&lt; intialize centroids with nbits-D hypercube</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931">   45</a></span>&#160;<span class="comment"></span>        <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931">Train_hypercube_pca</a>,   <span class="comment">///&lt; intialize centroids with nbits-D hypercube</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment"></span>    };</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">train_type_t</a> train_type;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#af265acf5aa1bcda60898002287e6a3d6">   49</a></span>&#160;    <a class="code" href="structfaiss_1_1ClusteringParameters.html">ClusteringParameters</a> <a class="code" href="structfaiss_1_1ProductQuantizer.html#af265acf5aa1bcda60898002287e6a3d6">cp</a>; <span class="comment">///&lt; parameters used during clustering</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="comment"></span><span class="comment"></span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment">    /// if non-NULL, use this index for assignment (should be of size</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment">    /// d / M)</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a62def246cfef670f2973fdf4af1414e1">   53</a></span>&#160;<span class="comment"></span>    <a class="code" href="structfaiss_1_1Index.html">Index</a> *<a class="code" href="structfaiss_1_1ProductQuantizer.html#a62def246cfef670f2973fdf4af1414e1">assign_index</a>;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="comment">    /// Centroid table, size M * ksub * dsub</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">   56</a></span>&#160;<span class="comment"></span>    std::vector&lt;float&gt; <a class="code" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a>;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="comment">    /// return the centroids associated with subvector m</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22">   59</a></span>&#160;<span class="comment"></span>    <span class="keywordtype">float</span> * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22">get_centroids</a> (<span class="keywordtype">size_t</span> m, <span class="keywordtype">size_t</span> i) {</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        <span class="keywordflow">return</span> &amp;<a class="code" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a> [(m * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">ksub</a> + i) * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">dsub</a>];</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    }</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keyword">const</span> <span class="keywordtype">float</span> * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22">get_centroids</a> (<span class="keywordtype">size_t</span> m, <span class="keywordtype">size_t</span> i)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        <span class="keywordflow">return</span> &amp;<a class="code" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a> [(m * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">ksub</a> + i) * <a class="code" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">dsub</a>];</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    }</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="comment">// Train the product quantizer on a set of points. A clustering</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="comment">// can be set on input to define non-default clustering parameters</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="keywordtype">void</span> train (<span class="keywordtype">int</span> n, <span class="keyword">const</span> <span class="keywordtype">float</span> *x);</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    ProductQuantizer(<span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">d</a>, <span class="comment">/* dimensionality of the input vectors */</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;            <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">M</a>,          <span class="comment">/* number of subquantizers */</span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            <span class="keywordtype">size_t</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">nbits</a>);     <span class="comment">/* number of bit per subvector index */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    ProductQuantizer ();</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="comment">    /// compute derived values when d, M and nbits have been set</span></div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ab3067f333b26811537a8519fb08292ce">set_derived_values</a> ();</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="comment">    /// Define the centroids for subquantizer m</span></div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ad291f113c6d44a634ddc1972f9a3c775">set_params</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * <a class="code" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a>, <span class="keywordtype">int</span> m);</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="comment">    /// Quantize one vector with the product quantizer</span></div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a08b130e3a21f2699a4e3bbec121fb838">compute_code</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x, uint8_t * code) <span class="keyword">const</span> ;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="comment">    /// same as compute_code for several vectors</span></div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#ae5a340ee5a4b1d35a565b167de2a2ef1">compute_codes</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                        uint8_t * codes,</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;                        <span class="keywordtype">size_t</span> n) <span class="keyword">const</span> ;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="comment">    /// decode a vector from a given code (or n vectors if third argument)</span></div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a7afbf9d96276f021981e99f064254208">decode</a> (<span class="keyword">const</span> uint8_t *code, <span class="keywordtype">float</span> *x) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a7afbf9d96276f021981e99f064254208">decode</a> (<span class="keyword">const</span> uint8_t *code, <span class="keywordtype">float</span> *x, <span class="keywordtype">size_t</span> n) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="comment">    /// If we happen to have the distance tables precomputed, this is</span></div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="comment">    /// more efficient to compute the codes.</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="comment"></span>    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a95060fedd7c09eb20e968fd2fdb4b316">compute_code_from_distance_table</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> *tab,</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;                                           uint8_t *code) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="comment">    /** Compute distance table for one vector.</span></div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;<span class="comment">     *</span></div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="comment">     * The distance table for x = [x_0 x_1 .. x_(M-1)] is a M * ksub</span></div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="comment">     * matrix that contains</span></div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="comment">     *</span></div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;<span class="comment">     *   dis_table (m, j) = || x_m - c_(m, j)||^2</span></div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="comment">     *   for m = 0..M-1 and j = 0 .. ksub - 1</span></div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="comment">     *</span></div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="comment">     * where c_(m, j) is the centroid no j of sub-quantizer m.</span></div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="comment">     *</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="comment">     * @param x         input vector size d</span></div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="comment">     * @param dis_table output table, size M * ksub</span></div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a36361f41bcd2fa698f3c39eb7111ed09">compute_distance_table</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;                                 <span class="keywordtype">float</span> * dis_table) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    <span class="keywordtype">void</span> compute_inner_prod_table (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;                                   <span class="keywordtype">float</span> * dis_table) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="comment">    /** compute distance table for several vectors</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="comment">     * @param nx        nb of input vectors</span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="comment">     * @param x         input vector size nx * d</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="comment">     * @param dis_table output table, size nx * M * ksub</span></div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a3521b9a36c28219fd6180cc7a9ce8207">compute_distance_tables</a> (<span class="keywordtype">size_t</span> nx,</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;                                  <span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;                                  <span class="keywordtype">float</span> * dis_tables) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <span class="keywordtype">void</span> compute_inner_prod_tables (<span class="keywordtype">size_t</span> nx,</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;                                    <span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;                                    <span class="keywordtype">float</span> * dis_tables) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<span class="comment">    /** perform a search (L2 distance)</span></div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="comment">     * @param x        query vectors, size nx * d</span></div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="comment">     * @param nx       nb of queries</span></div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="comment">     * @param codes    database codes, size ncodes * byte_per_idx</span></div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="comment">     * @param ncodes   nb of nb vectors</span></div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;<span class="comment">     * @param res      heap array to store results (nh == nx)</span></div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;<span class="comment">     * @param init_finalize_heap  initialize heap (input) and sort (output)?</span></div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;<span class="comment">     */</span></div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a1ae7892a15b9f6809a3ba1a123a7831b">search</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;                 <span class="keywordtype">size_t</span> nx,</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;                 <span class="keyword">const</span> uint8_t * codes,</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;                 <span class="keyword">const</span> <span class="keywordtype">size_t</span> ncodes,</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;                 float_maxheap_array_t *res,</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;                 <span class="keywordtype">bool</span> init_finalize_heap = <span class="keyword">true</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="comment">    /** same as search, but with inner product similarity */</span></div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;    <span class="keywordtype">void</span> <a class="code" href="structfaiss_1_1ProductQuantizer.html#a66be226806ca2abcaaf1653cdc690aa6">search_ip</a> (<span class="keyword">const</span> <span class="keywordtype">float</span> * x,</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;                 <span class="keywordtype">size_t</span> nx,</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;                 <span class="keyword">const</span> uint8_t * codes,</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;                 <span class="keyword">const</span> <span class="keywordtype">size_t</span> ncodes,</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;                 float_minheap_array_t *res,</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;                 <span class="keywordtype">bool</span> init_finalize_heap = <span class="keyword">true</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;<span class="comment">    /// Symmetric Distance Table</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"><a class="line" href="structfaiss_1_1ProductQuantizer.html#a6bd65fb4407452f73acb7242931d09e4">  159</a></span>&#160;<span class="comment"></span>    std::vector&lt;float&gt; <a class="code" href="structfaiss_1_1ProductQuantizer.html#a6bd65fb4407452f73acb7242931d09e4">sdc_table</a>;</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    <span class="comment">// intitialize the SDC table from the centroids</span></div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="keywordtype">void</span> compute_sdc_table ();</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;    <span class="keywordtype">void</span> search_sdc (<span class="keyword">const</span> uint8_t * qcodes,</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                     <span class="keywordtype">size_t</span> nq,</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                     <span class="keyword">const</span> uint8_t * bcodes,</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;                     <span class="keyword">const</span> <span class="keywordtype">size_t</span> ncodes,</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;                     <a class="code" href="structfaiss_1_1HeapArray.html">float_maxheap_array_t</a> * res,</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;                     <span class="keywordtype">bool</span> init_finalize_heap = <span class="keyword">true</span>) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;};</div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;} <span class="comment">// namespace faiss</span></div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_ad291f113c6d44a634ddc1972f9a3c775"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#ad291f113c6d44a634ddc1972f9a3c775">faiss::ProductQuantizer::set_params</a></div><div class="ttdeci">void set_params(const float *centroids, int m)</div><div class="ttdoc">Define the centroids for subquantizer m. </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00179">ProductQuantizer.cpp:179</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931">faiss::ProductQuantizer::Train_hypercube_pca</a></div><div class="ttdoc">intialize centroids with nbits-D hypercube </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00045">ProductQuantizer.h:45</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_ac920fea11f02e8407d12cc99a09f5ea5"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">faiss::ProductQuantizer::nbits</a></div><div class="ttdeci">size_t nbits</div><div class="ttdoc">number of bits per quantization index </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00029">ProductQuantizer.h:29</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a7afbf9d96276f021981e99f064254208"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a7afbf9d96276f021981e99f064254208">faiss::ProductQuantizer::decode</a></div><div class="ttdeci">void decode(const uint8_t *code, float *x) const </div><div class="ttdoc">decode a vector from a given code (or n vectors if third argument) </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00339">ProductQuantizer.cpp:339</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a13bf69a0dc7b4e45792d10f458e4a92d"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a13bf69a0dc7b4e45792d10f458e4a92d">faiss::ProductQuantizer::byte_per_idx</a></div><div class="ttdeci">size_t byte_per_idx</div><div class="ttdoc">nb bytes per code component (1 or 2) </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00033">ProductQuantizer.h:33</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e">faiss::ProductQuantizer::Train_hypercube</a></div><div class="ttdoc">intialize centroids with nbits-D hypercube </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00044">ProductQuantizer.h:44</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_ab3067f333b26811537a8519fb08292ce"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#ab3067f333b26811537a8519fb08292ce">faiss::ProductQuantizer::set_derived_values</a></div><div class="ttdeci">void set_derived_values()</div><div class="ttdoc">compute derived values when d, M and nbits have been set </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00166">ProductQuantizer.cpp:166</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a6bd65fb4407452f73acb7242931d09e4"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a6bd65fb4407452f73acb7242931d09e4">faiss::ProductQuantizer::sdc_table</a></div><div class="ttdeci">std::vector&lt; float &gt; sdc_table</div><div class="ttdoc">Symmetric Distance Table. </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00159">ProductQuantizer.h:159</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d">faiss::ProductQuantizer::Train_shared</a></div><div class="ttdoc">share dictionary accross PQ segments </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00043">ProductQuantizer.h:43</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a467b451ca203544e42c250e4be65b983"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">faiss::ProductQuantizer::dsub</a></div><div class="ttdeci">size_t dsub</div><div class="ttdoc">dimensionality of each subvector </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00032">ProductQuantizer.h:32</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3521b9a36c28219fd6180cc7a9ce8207"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3521b9a36c28219fd6180cc7a9ce8207">faiss::ProductQuantizer::compute_distance_tables</a></div><div class="ttdeci">void compute_distance_tables(size_t nx, const float *x, float *dis_tables) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00440">ProductQuantizer.cpp:440</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a95060fedd7c09eb20e968fd2fdb4b316"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a95060fedd7c09eb20e968fd2fdb4b316">faiss::ProductQuantizer::compute_code_from_distance_table</a></div><div class="ttdeci">void compute_code_from_distance_table(const float *tab, uint8_t *code) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00364">ProductQuantizer.cpp:364</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_ae5a340ee5a4b1d35a565b167de2a2ef1"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#ae5a340ee5a4b1d35a565b167de2a2ef1">faiss::ProductQuantizer::compute_codes</a></div><div class="ttdeci">void compute_codes(const float *x, uint8_t *codes, size_t n) const </div><div class="ttdoc">same as compute_code for several vectors </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00386">ProductQuantizer.cpp:386</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a36361f41bcd2fa698f3c39eb7111ed09"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a36361f41bcd2fa698f3c39eb7111ed09">faiss::ProductQuantizer::compute_distance_table</a></div><div class="ttdeci">void compute_distance_table(const float *x, float *dis_table) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00411">ProductQuantizer.cpp:411</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a1ae7892a15b9f6809a3ba1a123a7831b"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a1ae7892a15b9f6809a3ba1a123a7831b">faiss::ProductQuantizer::search</a></div><div class="ttdeci">void search(const float *x, size_t nx, const uint8_t *codes, const size_t ncodes, float_maxheap_array_t *res, bool init_finalize_heap=true) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00541">ProductQuantizer.cpp:541</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_aa61330eadb84772b71018b093773a5f9"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#aa61330eadb84772b71018b093773a5f9">faiss::ProductQuantizer::code_size</a></div><div class="ttdeci">size_t code_size</div><div class="ttdoc">byte per indexed vector </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00034">ProductQuantizer.h:34</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a62def246cfef670f2973fdf4af1414e1"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a62def246cfef670f2973fdf4af1414e1">faiss::ProductQuantizer::assign_index</a></div><div class="ttdeci">Index * assign_index</div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00053">ProductQuantizer.h:53</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a0feee45e4151547b7a0444c14bad398f"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">faiss::ProductQuantizer::ksub</a></div><div class="ttdeci">size_t ksub</div><div class="ttdoc">number of centroids for each subquantizer </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00035">ProductQuantizer.h:35</a></div></div>
<div class="ttc" id="structfaiss_1_1HeapArray_html"><div class="ttname"><a href="structfaiss_1_1HeapArray.html">faiss::HeapArray</a></div><div class="ttdef"><b>Definition:</b> <a href="Heap_8h_source.html#l00350">Heap.h:350</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a66be226806ca2abcaaf1653cdc690aa6"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a66be226806ca2abcaaf1653cdc690aa6">faiss::ProductQuantizer::search_ip</a></div><div class="ttdeci">void search_ip(const float *x, size_t nx, const uint8_t *codes, const size_t ncodes, float_minheap_array_t *res, bool init_finalize_heap=true) const </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00566">ProductQuantizer.cpp:566</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a08b130e3a21f2699a4e3bbec121fb838"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a08b130e3a21f2699a4e3bbec121fb838">faiss::ProductQuantizer::compute_code</a></div><div class="ttdeci">void compute_code(const float *x, uint8_t *code) const </div><div class="ttdoc">Quantize one vector with the product quantizer. </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8cpp_source.html#l00312">ProductQuantizer.cpp:312</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0">faiss::ProductQuantizer::Train_hot_start</a></div><div class="ttdoc">the centroids are already initialized </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00042">ProductQuantizer.h:42</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_af265acf5aa1bcda60898002287e6a3d6"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#af265acf5aa1bcda60898002287e6a3d6">faiss::ProductQuantizer::cp</a></div><div class="ttdeci">ClusteringParameters cp</div><div class="ttdoc">parameters used during clustering </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00049">ProductQuantizer.h:49</a></div></div>
<div class="ttc" id="structfaiss_1_1ClusteringParameters_html"><div class="ttname"><a href="structfaiss_1_1ClusteringParameters.html">faiss::ClusteringParameters</a></div><div class="ttdef"><b>Definition:</b> <a href="Clustering_8h_source.html#l00024">Clustering.h:24</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a83600e328893ce5f41fe459f5a3acf41"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">faiss::ProductQuantizer::M</a></div><div class="ttdeci">size_t M</div><div class="ttdoc">number of subquantizers </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00028">ProductQuantizer.h:28</a></div></div>
<div class="ttc" id="structfaiss_1_1Index_html"><div class="ttname"><a href="structfaiss_1_1Index.html">faiss::Index</a></div><div class="ttdef"><b>Definition:</b> <a href="Index_8h_source.html#l00060">Index.h:60</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html">faiss::ProductQuantizer</a></div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00025">ProductQuantizer.h:25</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a4f0f33c011dffe633a1748a48a082c22"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22">faiss::ProductQuantizer::get_centroids</a></div><div class="ttdeci">float * get_centroids(size_t m, size_t i)</div><div class="ttdoc">return the centroids associated with subvector m </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00059">ProductQuantizer.h:59</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a567cd512438f9e3404d9339a232d7695"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">faiss::ProductQuantizer::d</a></div><div class="ttdeci">size_t d</div><div class="ttdoc">size of the input vectors </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00027">ProductQuantizer.h:27</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a1e4056fa3938ed8c9fe701e90d94ad95"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a1e4056fa3938ed8c9fe701e90d94ad95">faiss::ProductQuantizer::verbose</a></div><div class="ttdeci">bool verbose</div><div class="ttdoc">verbose during training? </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00036">ProductQuantizer.h:36</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_aab1109a29ba0544358e274d727b23cae"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">faiss::ProductQuantizer::centroids</a></div><div class="ttdeci">std::vector&lt; float &gt; centroids</div><div class="ttdoc">Centroid table, size M * ksub * dsub. </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00056">ProductQuantizer.h:56</a></div></div>
<div class="ttc" id="structfaiss_1_1ProductQuantizer_html_a3a41c6286095e731be744548d9535a35"><div class="ttname"><a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">faiss::ProductQuantizer::train_type_t</a></div><div class="ttdeci">train_type_t</div><div class="ttdoc">initialization </div><div class="ttdef"><b>Definition:</b> <a href="ProductQuantizer_8h_source.html#l00040">ProductQuantizer.h:40</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
